<script lang="ts">
export default {
  components: { index },
  name: "videoqita",
};
</script>
<template>
  <div class="page-box h100 display-flex czbj videowe-page">
    <div class="tabs-box">
      <n-input-group>
        <n-input :style="{ width: '20%' }" v-model:value="inputVal" />
        <n-button type="primary" @click="serinout"> 搜索 </n-button>
      </n-input-group>
      <n-tabs type="line" v-model:value="tabsValue" @update:value="tabupdate">
        <n-tab name="1"> 亚洲情色 </n-tab>
        <n-tab name="2"> 热门女优 </n-tab>
        <n-tab name="3">中文字幕 </n-tab>
        <n-tab name="4"> 国产自拍 </n-tab>
        <n-tab name="5"> 无码专区 </n-tab>
        <n-tab name="6"> 伦理三级 </n-tab>
      </n-tabs>
    </div>
    <div class="videowe-box">
      <div
        class="video-box sz"
        v-for="(item, idx) in dataList"
        :key="idx"
        @click="
          hfs('qitaxq', {
            id: item.id,
          })
        "
      >
        <img class="img-box" :src="item.fm" />
        <p class="fz16 nowrap dsfdtt">
          {{ item.title }}
        </p>
      </div>
    </div>
    <div class="referenceqita cen">
      <n-spin size="small" /> <span class="z9 fz14 ml10">玩命加载中...</span>
    </div>
    <!-- <div class="mt20">
        <n-pagination v-model:page="page" :page-count="pageCount" @update:page="dfdrter"/>
    </div> -->
  </div>
</template>
 <script lang='ts' setup>
import { NPagination } from "naive-ui";
import { dxget, bottomMonitor, hf } from "../../util/index";
import { h, ref, onMounted,getCurrentInstance } from "vue";
import index from "../index.vue";
const { proxy } = getCurrentInstance(); 
let dataList = ref([]);
let showModal = ref(true);
let page = ref(1);
let tabsValue = ref(1);
let pageCount = ref();
let inputVal = ref("");
const getVideo = async () => {
  let { data }: any = await dxget("pacong/sg", {
    page: page.value,
    type: tabsValue.value,
    text: inputVal.value,
  });
  data.co_content8.map((a) => {
    dataList.value.push(a);
  });
  pageCount.value = data.pageSize;
};
const dfdrter = (e) => {
  page.value = e;
  getVideo();
};
let bodyStyle = {
  width: "800px",
};

const hfs = (url, data) => {
  hf(url, data);
};
const tabupdate = (num) => {
  inputVal.value = "";
  dataList.value = [];
  page.value = 1;
  tabsValue.value = num;
};
const serinout = () => {
  page.value = 1;
  dataList.value = [];
  getVideo();
};
onMounted(() => {
  bottomMonitor("referenceqita", () => {
    getVideo();
    page.value++;
  });
});

// setTimeout(() => {
//   document.getElementById("dfdfdsfds").focus();
// }, 3000);
document.onkeydown = function (event) {
  console.log(event.keyCode)
  if (event.keyCode == 39) {
    let activeEl = document.activeElement;
    let nextEl:any = activeEl.nextElementSibling;
    nextEl && nextEl.focus();
  }
};
</script>

 <style scoped>
.img-box {
  width: 100%;
  height: 300px;
  border-radius: 4px;
  overflow: hidden;
  background: #f8f8f8;
}

.dsfdtt {
  max-width: 170px;
  overflow: hidden;
}
.videowe-box {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(1, 1fr);
  grid-column-gap: 10px;
  grid-row-gap: 10px;
}
.tabs-box {
  position: sticky;
  left: 0;
  top: -10px;
  z-index: 1000;

  background: #fff;
}
.videowe-page {
  overflow: auto;
}

</style>